package cn.hnbjx.prepaid.controller;

import cn.hnbjx.prepaid.pojo.File;
import cn.hnbjx.prepaid.service.FileService;
import cn.hnbjx.prepaid.utils.Result;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FileController {

    @Autowired
    private FileService fileService;

    //查询所有file
    @PostMapping ("admin/file/list")
    public Result findByFileAll(Integer page, Integer pageSize){
        PageInfo<File> byFileAll = fileService.findByFileAll(page,pageSize);
        return Result.ok(byFileAll);
    }

    //根据id删除file
    @PostMapping("admin/file/delete")
    public Result DeleteFile(Integer fileId){
        fileService.DeleteFile(fileId );
        return Result.ok("删除成功");
    }
}
